package com.dameng.work.controller;


import com.alibaba.fastjson.JSON;
import com.dameng.work.pojo.Account;
import com.dameng.work.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

@Controller
public class AccountController {
    @Autowired
    private AccountService tArticleService;


    @RequestMapping("/findList")
    @ResponseBody
    public String findAllPage(){


        List<Account> all = tArticleService.findAll();
        Map<String, Object> returnMap = new HashMap<>();

        returnMap.put("state","1" );
        returnMap.put("result",all);
        return  JSON.toJSONString(returnMap);

    }
    @RequestMapping("/findListByDate")
    @ResponseBody
    public String findListByDate(){


        List<Account> all = tArticleService.findAllByDate();
        Map<String, Object> returnMap = new HashMap<>();

        returnMap.put("state","1" );
        returnMap.put("result",all);
        return  JSON.toJSONString(returnMap);

    }

}
